Skip to content

Conversation

@ivicac
Copy link
Contributor

@ivicac ivicac commented Dec 23, 2025

  • 3778 client - Improve project deletion and workflow handling with query cancellation and conditional fetching
  • 3778 client - Fix delete dropdown propagation issue in ProjectListItem by adding event.stopPropagation

@ivicac ivicac changed the title 3778 3778 Fix delete dropdown propagation issue in ProjectListItem by adding event.stopPropagation Dec 23, 2025
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed for 'client'

Failed conditions
30.8% Coverage on New Code (required ≥ 80%)
24.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses issue #3778 by improving project deletion handling and fixing a dropdown propagation issue. The changes ensure proper query cleanup when deleting projects and prevent unintended collapsible behavior when clicking dropdown menu items.

  • Added query cancellation and removal for deleted projects to prevent stale data issues
  • Fixed event propagation for the delete dropdown menu item to prevent triggering parent click handlers
  • Implemented conditional workflow query fetching to avoid unnecessary API calls during project refetch operations

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
ProjectWorkflowList.tsx Added queryEnabled prop to conditionally enable/disable workflow queries based on project refetch state
ProjectListItem.tsx Added event.stopPropagation() to delete dropdown item and query cleanup logic for deleted projects
ProjectList.tsx Added isRefetchingProjects prop to control workflow query execution during project list updates
Projects.tsx Moved queryClient initialization earlier and added isRefetchingProjects calculation to detect ongoing query operations
useSettingsMenu.ts Added query cancellation and removal logic for project deletion to maintain consistency with ProjectListItem

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

const {data: workflows, isLoading: isProjectWorkflowsLoading} = useGetProjectWorkflowsQuery(
project.id!,
!!project.id
queryEnabled && !!project.id
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic queryEnabled && !!project.id will evaluate to undefined (falsy) when queryEnabled is undefined, which would disable the query by default. This is problematic because the prop is optional (queryEnabled?: boolean), meaning if this component is used elsewhere without explicitly passing this prop, the query would be unexpectedly disabled.

Consider using a default value to make the behavior more predictable. The condition should be (queryEnabled ?? true) && !!project.id or set a default parameter value in the function signature.

Suggested change
queryEnabled && !!project.id
(queryEnabled ?? true) && !!project.id

Copilot uses AI. Check for mistakes.
Comment on lines +496 to +500
onClick={(event: MouseEvent) => {
setShowDeleteDialog(true);

event.stopPropagation();
}}
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Delete dropdown menu item now includes event.stopPropagation(), but other dropdown menu items in the same menu (Publish, Edit, Duplicate, View Workflows, Share, Export, Pull Project from Git, Git Configuration) do not. While the handleProjectListItemClick function checks for .dropdown-menu-item selector to prevent propagation, this creates an inconsistency in how events are handled.

For consistency and clarity, either all dropdown menu items should call stopPropagation(), or none should (relying only on the selector-based check in handleProjectListItemClick). If there's a specific issue with the Delete button that required this fix, the same issue likely affects other menu items as well.

Copilot uses AI. Check for mistakes.
@ivicac ivicac linked an issue Dec 23, 2025 that may be closed by this pull request
@kresimir-coko kresimir-coko merged commit a407ca3 into master Dec 28, 2025
12 of 13 checks passed
@kresimir-coko kresimir-coko deleted the 3778 branch December 28, 2025 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Error appears when deleting a project

3 participants